﻿using KingerRobot.MexicoSailunMDC.Dao;
using System.Text.Json.Serialization;


namespace KingerRobot.MexicoSailunWMS.Spi;


/// <summary>
///  监控
/// </summary>
public interface IMonitorManageService
{
    /// <summary>
    /// 监控，线体部分,展示输送线所有节点
    /// </summary>
    /// <returns></returns>
    List<LineMonitorBeans> GetLineMonitorBeans(LineMonitorParam param);
    List<LineMonitorBeans> GetLineMonitorBeansV2();
    List<LineMonitorBeans> GetLineMonitorBeansV3();
    List<LineMonitorBeans> GetLineMonitorBeansNew();
    List<POVLocationEnableNum> GetRcsLocation();
    CuringListBeans GetCuringNodesByEquipId(CuringNodeParam param);

    //List<TemAndHumBeans> GetTemperatureAndHumidity();

    /// <summary>
    /// 库存状态图——第二版
    /// </summary>
    /// <param name="param"></param>
    /// <returns></returns>
    CrnLocBeans GetLocMonitorsByCrn(CrnLocParam param);
    /// <summary>
    /// 获取硫化机排信息
    /// </summary>
    /// <param name="param"></param>
    /// <returns></returns>
    List<CuringMessageBeans> GetCuringMessageBeans(CuringMessageParam param);
    LineInfoBean GetLineInfoByLineId(LineInfoParam param);

    /// <summary>
    /// 堆垛机监控—— 之 —— 任务
    /// </summary>
    /// <param name="param"></param>
    /// <returns></returns>
    List<CrnTaskBeans> GetCrnTask(CrnMonitorParam param);

    /// <summary>
    /// 堆垛机监控 —— 之 —— 设备 
    /// </summary>
    CrnEquipBeans GetCrnEquip(CrnMonitorParam param);

    /// <summary>
    /// 指令重发
    /// </summary>
    /// <param name="cmdId"></param>
    /// <returns></returns>
    int ReSendCmds(long? cmdId, long userId, string userName, string clientHost);


    /// <summary>
    /// 堆垛机监控—— 之 —— 任务
    /// </summary>
    /// <param name="param"></param>
    /// <returns></returns>
    List<EMSTaskBeans> GetEMSTasks(EmsMonitorParam param);

    /// <summary>
    /// 堆垛机监控 —— 之 —— 设备 
    /// </summary>
    EMSEquipBeans GetEMSEquip(EmsMonitorParam param);

    List<POSeBox> GetScadaBoxs();
    int UpdateLineValue(UpdateLineInfoParam param);

}




#region 条件查询

/// <summary>
/// 线体监控参数
/// </summary>
public class LineMonitorParam
{
    /// <summary>
    /// 是否是第一次查询
    /// </summary>
    public bool? IsFirstTime { get; set; }
}

public class CuringNodeParam
{
    public long? EquipId { get; set; }
}

/// <summary>
/// 硫化机排参数
/// </summary>
public class CuringMessageParam
{
    /// <summary>
    /// 坐标X
    /// </summary>
    public int X { get; set; }

    /// <summary>
    /// 坐标Y
    /// </summary>
    public int Y { get; set; }
}

public class CuringListParam
{
    public string CuringCode { get; set; }
}

/// <summary>
/// 堆垛机监控
/// </summary>
public class CrnMonitorParam
{
    /// <summary>
    /// 堆垛机名
    /// </summary>
    public string CrnName { get; set; }
}

/// <summary>
/// EMS监控
/// </summary>
public class EmsMonitorParam
{
    /// <summary>
    /// EMS 名
    /// </summary>
    public string EmsName { get; set; }
}
#endregion


#region Beans

/// <summary>
/// 线体监控返回Beans
/// </summary>
public class LineMonitorBeans
{
    /// <summary>
    /// 节点Id
    /// </summary>
    public long? Id { get; set; }

    /// <summary>
    /// 用来关联scada_box_tasks表，字段：LineCode（线体编号）
    /// </summary>
    public String BoxCode { get; set; }

    /// <summary>
    /// 坐标 X
    /// </summary>
    public int? BoxLeft { get; set; }

    /// <summary>
    /// 坐标 Y
    /// </summary>
    public int? BoxTop { get; set; }

    /// <summary>
    ///     宽
    /// </summary>
    public int? BoxWidth { get; set; }

    /// <summary>
    ///     高
    /// </summary>
    public int? BoxHeight { get; set; }

    /// <summary>
    ///     先后顺序
    /// </summary>
    public int? BoxIndex { get; set; }

    /// <summary>
    ///     是否可用
    /// </summary>
    public int? UseFlag { get; set; }


    /// <summary>
    /// 样式
    /// </summary>
    public string Styles { get; set; }

    /// <summary>
    /// 点位编号
    /// </summary>
    public string ShowName { get; set; }

    /// <summary>
    /// 点位名
    /// </summary>
    public string BoxName { get; set; }

    /// <summary>
    /// 流水号
    /// </summary>
    public int? TaskNo { get; set; }
    /// <summary>
    /// 流水号2
    /// </summary>
    public int? TaskNo2 { get; set; }

    /// <summary>
    /// 鼠标悬停结果
    /// </summary>
    public string MouseOverResult { get; set; }

    /// <summary>
    /// 产品条码
    /// </summary>
    public string ProductCode { get; set; }


    public long? LocId { get; set; }


    public long? ShowCode { get; set; }


    public string ShowType { get; set; }
    public string TcmSpec { get; set; }
    public string TcmSpecDesc { get; set; }

    public int? BoxType { get; set; }

    public long? EquipId { get; set; }

    public string RvcFlag { get; set; }

}

public class CrnLocBeans
{
    public List<CrnLocNodes> StockFirstNodes { get; set; }

    public List<CrnLocNodes> StockLastNodes { get; set; }
}
/// <summary>
/// 库存状态图
/// </summary>
public class CrnLocParam
{
    /// <summary>
    /// 堆垛机名
    /// </summary>
    public string CrnName { get; set; }
    /// <summary>
    /// 立库
    /// </summary>
    public int? WarehouseNo { get; set; }
}
public class CrnLocNodes
{
    public LocNodeBean Node1 { get; set; }
    public LocNodeBean Node2 { get; set; }
    public LocNodeBean Node3 { get; set; }
    public LocNodeBean Node4 { get; set; }
    public LocNodeBean Node5 { get; set; }
    public LocNodeBean Node6 { get; set; }
    public LocNodeBean Node7 { get; set; }
    public LocNodeBean Node8 { get; set; }
    public LocNodeBean Node9 { get; set; }
    public LocNodeBean Node10 { get; set; }
    public LocNodeBean Node11 { get; set; }
    public LocNodeBean Node12 { get; set; }
    public LocNodeBean Node13 { get; set; }
    public LocNodeBean Node14 { get; set; }
    public LocNodeBean Node15 { get; set; }
    public LocNodeBean Node16 { get; set; }
    public LocNodeBean Node17 { get; set; }
    public LocNodeBean Node18 { get; set; }
    public LocNodeBean Node19 { get; set; }
    public LocNodeBean? Node20 { get; set; }
    public LocNodeBean? Node21 { get; set; }
    public LocNodeBean? Node22 { get; set; }
    public LocNodeBean? Node23 { get; set; }
    public LocNodeBean? Node24 { get; set; }
    public LocNodeBean? Node25 { get; set; }
    public LocNodeBean? Node26 { get; set; }
    public LocNodeBean? Node27 { get; set; }
    public LocNodeBean? Node28 { get; set; }
    public LocNodeBean? Node29 { get; set; }
    public LocNodeBean? Node30 { get; set; }
    public LocNodeBean? Node31 { get; set; }
    public LocNodeBean? Node32 { get; set; }
    public LocNodeBean? Node33 { get; set; }
    public LocNodeBean? Node34 { get; set; }
    public LocNodeBean? Node35 { get; set; }
    public LocNodeBean? Node36 { get; set; }
    public LocNodeBean? Node37 { get; set; }
    public LocNodeBean? Node38 { get; set; }
    public LocNodeBean? Node39 { get; set; }
    public LocNodeBean? Node40 { get; set; }
}

public class LocNodeBean
{
    /// <summary>
    /// 库位Id
    /// </summary>
    public long? LocId { get; set; }

    /// <summary>
    ///  颜色
    /// </summary>
    public string Color { get; set; }


    /// <summary>
    /// 鼠标悬停结果
    /// </summary>
    public string MouseOverResult { get; set; }

    /// <summary>
    /// 显示文字
    /// </summary>
    public string Tips { get; set; }


}
/// <summary>
/// 硫化机排返回beans
/// </summary>
public class CuringMessageBeans
{
    /// <summary>
    /// 唯一Id
    /// </summary>
    public long? Id { get; set; }

    /// <summary>
    /// 任务号
    /// </summary>
    public int? TaskNo { get; set; }

    /// <summary>
    ///  是否可用
    /// </summary>
    public int? UseFlag { get; set; }

    /// <summary>
    /// 左右膜标识
    /// </summary>
    public string LeftRightFlag { get; set; }

    /// <summary>
    /// 硫化机编号
    /// </summary>
    public string CuringCode { get; set; }

    /// <summary>
    /// 鼠标悬停结果
    /// </summary>
    public string MouseOverResult { get; set; }

    /// <summary>
    /// 颜色
    /// </summary>
    public string Color { get; set; }
    /// <summary>
    /// 1:(1号右模；2号左模)；2:(1号左模；2号右模)
    /// </summary>
    public int Signs { get; set; }
    /// <summary>
    /// 1:(1号右模；2号左模)；2:(1号左模；2号右模)
    /// </summary>
    public int Index { get; set; }

    public long? SummaryId { get; set; }
    public DateTime? CmdTime { get; set; }
    public string SummaryReamrk { get; set; }

    public string SkuCode { get; set; }

    public string MaterialCode { get; set; }
    public string MaterialName { get; set; }


}

public class CuringListBeans
{
    /// <summary>
    /// 左右模详情
    /// </summary>
    public List<CuringDetailsBeans>? CuringDetails { get; set; }
    /// <summary>
    /// 未生成订单原因
    /// </summary>
    public string Remark { get; set; }
    /// <summary>
    /// 需求数
    /// </summary>
    public int? PlanCount { get; set; }
    /// <summary>
    /// 订单数
    /// </summary>
    public int? OrderCount { get; set; }
    /// <summary>
    /// 任务数
    /// </summary>
    public int? TaskCount { get; set; }
    public DateTime? CuringTime { get; set; }
    /// <summary>
    /// 可用库存
    /// </summary>
    public int? StockCount { get; set; }
    /// <summary>
    /// 超期库存
    /// </summary>
    public int? TimeOutCount { get; set; }
    /// <summary>
    /// 锁定库存
    /// </summary>
    public int? LockCount { get; set; }
    /// <summary>
    /// 试验台库存
    /// </summary>
    public int? ExperimentCount { get; set; }
    /// <summary>
    /// 硫化机编号
    /// </summary>
    public string CuringCode { get; set; }
}


public class CuringDetailsBeans
{
    public string CuringMode { get; set; }
    public string MaterialCode { get; set; }

    public string MaterialName { get; set; }
    public int? TaskNo { get; set; }
    public string ProductCode { get; set; }

}
public class StockBeans
{
    public string ProductCode { get; set; }
    public string MaterialCode { get; set; }

    public long? MaterialId { get; set; }
    public int? TireLock { get; set; }
    public DateTime? TbmExpirationTime { get; set; }

}




/// <summary>
/// 堆垛机监控 —— 之 —— 任务 beans
/// </summary>
public class CrnTaskBeans
{
    /// <summary>
    /// 指令Id，（用来作为指令重发返回的参数）
    /// </summary>
    public long? CmdId { get; set; }

    /// <summary>
    /// 任务Id，（用来作为任务删除和任务完成的参数）
    /// </summary>
    public long? TaskId { get; set; }

    /// <summary>
    /// 货叉名
    /// </summary>
    public string ForkName { get; set; }

    /// <summary>
    /// 任务号
    /// </summary>
    public int? TaskNo { get; set; }

    /// <summary>
    /// 任务类型
    /// </summary>
    public string TaskType { get; set; }

    /// <summary>
    /// 任务状态
    /// </summary>
    public string TaskStatus { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime? CreateTime { get; set; }

    /// <summary>
    /// 执行时间
    /// </summary>
    public DateTime? ExecTime { get; set; }

    /// <summary>
    /// 取胎位
    /// </summary>
    public string TakeLoc { get; set; }

    /// <summary>
    /// 目标位
    /// </summary>
    public string TargetLoc { get; set; }

    /// <summary>
    /// 放胎位
    /// </summary>
    public string PlaceLoc { get; set; }

    /// <summary>
    /// 条码
    /// </summary>
    public string ProductCode { get; set; }

    /// <summary>
    /// 规格
    /// </summary>
    public string Spec { get; set; }

    /// <summary>
    /// 质量
    /// </summary>
    public string Status { get; set; }

    /// <summary>
    /// 冻结
    /// </summary>
    public string Frozen { get; set; }

    /// <summary>
    /// 硫化机编号
    /// </summary>
    public string CuringCode { get; set; }

    /// <summary>
    /// 左右膜标志
    /// </summary>
    public string LRFlag { get; set; }
}

/// <summary>
/// 堆垛机监控 —— 之 —— 设备 beans
/// </summary>
public class CrnEquipBeans
{
    /// <summary>
    /// 堆垛机名称
    /// </summary>
    public string CrnName { get; set; }

    /// <summary>
    /// 设备状态 若 “禁用”，标红显示
    /// </summary>
    public string CrnStatus { get; set; }

    /// <summary>
    /// 报警状态 若 “报警中” ，标红显示
    /// </summary>
    public string ErrStatus { get; set; }

    /// <summary>
    /// 报警信息
    /// </summary>
    public string ErrMsg { get; set; }

    /// <summary>
    /// 任务数量
    /// </summary>
    public int? TaskCount { get; set; }

    /// <summary>
    /// 入库限制
    /// </summary>
    public int? InLimit { get; set; }

    /// <summary>
    /// 出库限制
    /// </summary>
    public int? OutLimit { get; set; }

    /// <summary>
    /// 库位数量
    /// </summary>
    public int? LocNum { get; set; }

    /// <summary>
    /// 禁用数量
    /// </summary>
    public int? LocNoEnableNum { get; set; }

    /// <summary>
    /// 空库位数量
    /// </summary>
    public int? EmptyNum { get; set; }

    /// <summary>
    /// 有货库位数量
    /// </summary>
    public int? NoEmptyNum { get; set; }

}

/// <summary>
/// EMS监控 —— 之 —— 任务 beans
/// </summary>
public class EMSTaskBeans
{
    /// <summary>
    /// 指令Id，（用来作为指令重发返回的参数）
    /// </summary>
    public long? CmdId { get; set; }

    /// <summary>
    /// 任务Id，（用来作为任务删除和任务完成的参数）
    /// </summary>
    public long? TaskId { get; set; }

    /// <summary>
    /// 货叉名
    /// </summary>
    public string EmsName { get; set; }

    /// <summary>
    /// 任务号
    /// </summary>
    public int? TaskNo { get; set; }

    /// <summary>
    /// 任务类型
    /// </summary>
    public string TaskType { get; set; }

    /// <summary>
    /// 任务状态
    /// </summary>
    public string TaskStatus { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime? CreateTime { get; set; }

    /// <summary>
    /// 执行时间
    /// </summary>
    public DateTime? ExecTime { get; set; }

    /// <summary>
    /// 取胎位
    /// </summary>
    public string TakeLoc { get; set; }

    /// <summary>
    /// 放胎位
    /// </summary>
    public string PlaceLoc { get; set; }

    /// <summary>
    /// 目标位
    /// </summary>
    public string TargetLoc { get; set; }

    /// <summary>
    /// 条码
    /// </summary>
    public string ProductCode { get; set; }

    /// <summary>
    /// 规格
    /// </summary>
    public string Spec { get; set; }

    /// <summary>
    /// 质量
    /// </summary>
    public string Status { get; set; }

    /// <summary>
    /// 冻结
    /// </summary>
    public string Frozen { get; set; }

    /// <summary>
    /// 硫化机编号
    /// </summary>
    public string CuringCode { get; set; }

    /// <summary>
    /// 左右膜标志
    /// </summary>
    public string LRFlag { get; set; }
}

/// <summary>
/// EMS监控 —— 之 —— 设备 beans
/// </summary>
public class EMSEquipBeans
{
    /// <summary>
    /// Ems名称
    /// </summary>
    public string EmsName { get; set; }

    /// <summary>
    /// 设备状态 若 “禁用”，标红显示
    /// </summary>
    public string CrnStatus { get; set; }

    /// <summary>
    /// 报警状态 若 “报警中” ，标红显示
    /// </summary>
    public string ErrStatus { get; set; }

    /// <summary>
    /// 报警信息
    /// </summary>
    public string ErrMsg { get; set; }

    /// <summary>
    /// 任务数量
    /// </summary>
    public int? TaskCount { get; set; }

}


/// <summary>
/// 线体监控返回Beans
/// </summary>
public class BuildingMonitorBeans
{
    /// <summary>
    /// 节点Id
    /// </summary>
    public long? Id { get; set; }

    /// <summary>
    /// 用来关联scada_box_tasks表，字段：LineCode（线体编号）
    /// </summary>
    public String BoxCode { get; set; }

    /// <summary>
    /// 坐标 X
    /// </summary>
    public int? BoxLeft { get; set; }

    /// <summary>
    /// 坐标 Y
    /// </summary>
    public int? BoxTop { get; set; }

    /// <summary>
    ///     宽
    /// </summary>
    public int? BoxWidth { get; set; }

    /// <summary>
    ///     高
    /// </summary>
    public int? BoxHeight { get; set; }

    /// <summary>
    ///     先后顺序
    /// </summary>
    public int? BoxIndex { get; set; }

    /// <summary>
    ///     是否可用
    /// </summary>
    public int? UseFlag { get; set; }


    /// <summary>
    /// 样式
    /// </summary>
    public string Styles { get; set; }

    /// <summary>
    /// 点位编号
    /// </summary>
    public string ShowName { get; set; }

    /// <summary>
    /// 点位名
    /// </summary>
    public string BoxName { get; set; }



    /// <summary>
    /// 鼠标悬停结果
    /// </summary>
    public string MouseOverResult { get; set; }



}

#endregion

public class WarehouseEmptyLocBeans
{
    public string WarehouseName { get; set; }

    public int NormalLocCount { get; set; }

    public int EmptyNormalLocCount { get; set; }

    public double NormalLocPercentage { get; set; }

    public string NormalLocColor { get; set; }

    public string HighValue { get; set; }
    public string MaxValue { get; set; }




}

public class TemAndHumBeans
{
    public string EquipId { get; set; }
    public double Temperature { get; set; }
    public double Humidity { get; set; }
    public string TemperColor { get; set; }
    public string HumColor { get; set; }

}
public class LineInfoParam
{
    public long? Id { get; set; }
}
public class LineInfoBean
{
    public long? Id { get; set; }
    public string BoxCode { get; set; }
    public int? TaskGroup { get; set; }
    public string TargetCode { get; set; }
    public int? TaskNo { get; set; }
}
public class UpdateLineInfoParam
{
    public long? Id { get; set; }
    public string BoxCode { get; set; }
    public int? TaskGroup { get; set; }
    public string TargetCode { get; set; }
    public int? TaskNo { get; set; }
}

